<!--
 * @Descripttion: 新人券包
 * @version: 
 * @Author:Hui
 * @Date: 2023-10-18 15:04:18
 * @LastEditTime: 2023-10-18 16:35:48
 * @LastEditors:Hui
-->

<template>
  <view class="page">
    <view class="rule_btn bg-default" @click="uniRouter.navigateTo('/pages/article/activityRule?symbol=newPeople_799')" />

    <view class="coupon_box">
      <view class="h3 bg-default" />
      <view class="coupon bg-default" />
      <button class="btn font-28 color-fff" @click="handleReceive">一键领取</button>
    </view>

    <user-phone
      v-if="showProductInfo.productId"
      :showProductInfo="showProductInfo"
    />

    <footer-fixed active="couponCenter" :userInfo="userInfo" />
  </view>
</template>


<script>

import { mapGetters } from 'vuex'

import { getUserReceiveBonus } from '@/api'

import { waitShowToast } from '@/utils'

import productEvaluateInfo from '@/mixins/productEvaluateInfo'

import UserPhone from './components/UserPhone.vue'
import FooterFixed from './components/FooterFixed.vue'


export default {
  components: {
    UserPhone, FooterFixed
  },

  mixins: [ productEvaluateInfo ],

  computed: {
		...mapGetters([
			'userInfo'
		])
	},

  onShow() {
    this.loadProductEvaluateInfo()
  },

  

  methods: {
    handleReceive() {
      if (!this.userInfo.userId) {
        this.goLogin()
        return
      }

      uni.showLoading({ title: '加载中', mask: true })

      getUserReceiveBonus(100001).then(({ msg, data, code }) => {
        if (code === 200) {
          waitShowToast(data)
        } else {
          waitShowToast(msg)
        }
      })
    }
  }
}
</script>


<style lang="scss" scoped>

</style>